package com.cloud_notes.demo.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cloud_notes.demo.common.pojo.dataobject.BlogInfo;
import com.cloud_notes.demo.common.pojo.response.BlogInfoResponse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;


//持久层

@Mapper
public interface BlogInfoMapper extends BaseMapper<BlogInfo> {

    //获取数据信息
    @Select("select blog_info.id,blog_info.title,blog_info.content,blog_info.user_id,blog_info.blog_type,products.image_url,blog_info.create_time,blog_info.update_time" +
            " from blog_info right join products on blog_info.user_id = products.blog_id where blog_info.delete_flag = 0 " +
            "order by blog_info.id DESC")
    List<BlogInfoResponse> selectBlogDetails();
}
